< previous page page_955 next page >

Page 955
e7ae6bd512ad4c3583017fcda52f57ae.gif
· You can't use the Seek method with Dynasets.
e7ae6bd512ad4c3583017fcda52f57ae.gif
· Errors can occur if records in the underlying table have been altered or deleted between the time that the Dynaset is created and the time that a record is updated.
5. Table data objects allow you to use indexes and the Seek method.
6. You do not use the Refresh method with the Table data object because this object is the underlying data.
7. You must use code to open a Table object in Visual Basic.
8. A Snapshot stores all the data in the workstation's memory, whereas the Dynaset stores only pointers to the data. The Snapshot is also read-only and can't be updated. A Dynaset can be updated.
9. You use the Database data object to extract field and table names from a database.
Answers to Day 3 Exercises
1. You use the Dynaset data object because it is the only data object that can update an ODBC data source. Your code might look like this:
Sub Form_Load()

'Create a database and dynaset object
Dim Dat as Database
Dim rsDyn as Recordset

'Declare standard variables
Dim cDBN ame as String
Dim cTable as String

'Initialize variables
cDBName = "c:\DATAS\ACCTPAY.MDB"
cTable = "Vendors"

'Set values
set Dat = OpenDatabase(cDBName)
Set rsDyn = Dat.OpenRecordset(cTable,dbOpenDynaset)

End Sub
2. The Snapshot data object should be used for this purpose because it does not change after it is created. This prevents the data used in your report from being updated while your report is generating.
Your code might look like this:
Sub Form_Load()

'Create a database and snapshot object
Dim Dat as Database
Dim rsSnap as Recordset

 
< previous page page_955 next page >

If you like this book, buy it!